<?php

namespace app\api\middleware;

class NotFoundMiddleware
{
    public function handle($request, \Closure $next)
    {
        // 执行下一个中间件
        $response = $next($request);

        // 如果路由未匹配成功
        if ($response->getCode() === 404) {
            apiReturn(400,'请求方法不存在');
        }

        return $response;
    }
}